import { useRequest } from '@h5app/sheep/hooks'
import { TodoProcessTypeEnum } from '../../../interface'

/** 处理待办数据 */
export const UnProcessTodo = (): Promise<ApiRequest.ResultDto<any>> => {
  const request = useRequest()

  return request({
    url: '/crmH5/todo/getUnProcessTodo',
    method: 'POST',
    data: {},
  })
}

/** 逾期最久的合同待办数据 */
export const TodoOverdueContract = (): Promise<ApiRequest.ResultDto<any>> => {
  const request = useRequest()

  return request({
    url: '/crmH5/todo/getOverdueLongestContractTodo',
    method: 'POST',
    data: {},
  })
}

/** 处理待办 */
export const TodoProcess = (data: {
  id: string
  process: TodoProcessTypeEnum
  reason?: string
}) => {
  const request = useRequest()

  return request({
    url: '/crmH5/todo/processTodo',
    method: 'POST',
    data: data,
  })
}

/** 统计数据 */
export const TodoStatistics = (data: any) => {
  const request = useRequest()

  return request({
    url: '/crmH5/todo/getStatistics',
    method: 'POST',
    data,
  })
}

/** 分页数据 */
export const TodoPage = (data: any) => {
  const request = useRequest()

  return request({
    url: '/crmH5/todo/getPage',
    method: 'POST',
    data,
  })
}
